{// 引入标签库 }
<tagLib name="html" />
<php>
function get_rel_data($id,$topic)
{
		if($topic['rel_table']=='buycomment')
		{
			//购物分享
			$message_item = M("Message")->getById($topic['rel_id']);
			$name = M($message_item['rel_table'])->where("id=".$message_item['rel_id'])->getField("name");
			$str = "<a href='".u("Message/index", array("id"=>$topic['rel_id']))."' title='".$name."'>[".l("COMMENT_GOODS")."]".msubstr($name,0,20)."</a>";
		}
		else
		$str = l("NO_REL_DATA");
		return $str;
}
</php>
<include file="Public:header" />
<script type="text/javascript">
	function del_img(id,o)
	{
		if(confirm("{%CONFIRM_DELETE_IMAGE}"))
		{
			$.ajax({ 
				url: ROOT+"?"+VAR_MODULE+"=TopicImage&"+VAR_ACTION+"=delete&id="+id, 
				data: "ajax=1",
				dataType: "json",
				success: function(obj){
					if(obj.status==1)
					{
						$(o).parent().remove();
					}
					else
					{
						alert(obj.data);
					}
				}
			});
		}
	}
	$(document).ready(function(){
		$("select[name='is_recommend']").bind("change",function(){
			toogle_recommend();
		});
		toogle_recommend();
	});
	function modify_title(o)
	{
		$(o).parent().remove();
		$("input[name='title']").show();
	}
	function modify_content(o)
	{
		$(o).parent().remove();
		$("textarea[name='content']").show();
	}
	function toogle_recommend()
	{
		var is_rec = $("select[name='is_recommend']").val();
		if(is_rec==1)
		{
			$("#recommend_daren_page").show();
		}
		else
		{
			$("#recommend_daren_page").hide();
			delimg("daren_page");
		}
	}
</script>
<div class="main">
<div class="main_title">{%VIEW} <a href="{:u("Topic/index")}" class="back_list">{%BACK_LIST}</a>

</div>
<div class="blank5"></div>
<form name="edit" action="__APP__" method="post" enctype="multipart/form-data">
<table class="form" cellpadding=0 cellspacing=0>
	<tr>
		<td colspan=2 class="topTd"></td>
	</tr>
	
	<tr>
		<td class="item_title">{%TITLE}:</td>
		<td>
			<div style="word-break:break-all;">{$vo.title}[<a href='javascript:;' onclick="modify_title(this);">{%MODIFY}</a>]</div>
			<input type="text" class="text" name="title" value="{$vo.title}" style="display:none;" />
		</td>
	</tr>	

	<tr>
		<td class="item_title">{%CONTENT}:</td>
		<td>
			<div style="word-break:break-all;">{$vo.content|nl2br|decode_topic}[<a href='javascript:;' onclick="modify_content(this);">{%MODIFY}</a>]</div>
			<textarea class="textarea" name="content" style="display:none;" >{$vo.content}</textarea>
		</td>
	</tr>
	<tr>
		<td class="item_title">{%CLICK_COUNT}:</td>
		<td>{$vo.click_count}</td>
	</tr>
	<tr>
		<td class="item_title">{%TOPIC_TAGS}:</td>
		<td> <input type="text" class="textbox" value="{$vo.tags}" name="tags" /></td>
	</tr>
	<tr>
		<td class="item_title">{%TOPIC_CATE_NAME}:</td>
		<td class="item_input">
			<foreach name="cate_list" item="cate_item">
				<label><input type="checkbox" value="{$cate_item.id}" name="cate_id[]" <if condition="$cate_item['checked'] gt 0">checked="checked"</if> />{$cate_item.name}</label>
			</foreach>
		</td>
	</tr>
	<tr>
		<td class="item_title">{%REPLY_COUNT}:</td>
		<td>{$vo.reply_count}</td>
	</tr>
	<tr>
		<td class="item_title">{%GOOD_COUNT}:</td>
		<td>{$vo.good_count}</td>
	</tr>
	<tr>
		<td class="item_title">{%BAD_COUNT}:</td>
		<td>{$vo.bad_count}</td>
	</tr>
	<tr>
		<td class="item_title">{%REL_DATA}:</td>
		<td><php>echo get_rel_data($vo['id'],$vo);</php></td>
	</tr>
	<tr>
		<td class="item_title">{%TOPIC_IMG}:</td>
		<td>&nbsp;
			<foreach name="image_list" item="image_item">
				<div class="topic_image">
					<span onclick="del_img({$image_item.id},this)">x</span>
					<img src="{$image_item.path}" />
				</div>
			</foreach>
		</td>
	</tr>
	<tr>
		<td class="item_title">推荐:</td>
		<td>
			<select name="is_recommend">
				<option value="0" <if condition="$vo['is_recommend'] eq 0">selected="selected"</if>>否</option>
				<option value="1" <if condition="$vo['is_recommend'] eq 1">selected="selected"</if>>是</option>
			</select>
		</td>
	</tr>
	<tr id="recommend_daren_page">
		<td class="item_title">达人秀封面图:</td>
		<td>
			<html:imgUpload name = 'daren_page' id='daren_page' value='$vo.daren_page' />
		</td>
	</tr>
	<tr>
		<td class="item_title"></td>
		<td class="item_input">
			<!--隐藏元素-->
			<input type="hidden" name="id" value="{$vo.id}" />
			<input type="hidden" name="{:conf("VAR_MODULE")}" value="Topic" />
			<input type="hidden" name="{:conf("VAR_ACTION")}" value="update" />
			<!--隐藏元素-->
			<input type="submit" class="button" value="{%EDIT}" />
		</td>
	</tr>
	<tr>
		<td colspan=2 class="bottomTd"></td>
	</tr>
</table>
<div class="blank5"></div>
</form>

</div>
<include file="Public:footer" />